The documentation below describes the
scripting interface for the Flash Player ActiveX
control. This control handles playback of Flash
content on Windows machines which support ActiveX (all 32-bit versions of
Windows, beginning with Windows 95.) These methods
may also be available to PocketPC Devices using
the Flash Player for PocketPC (see the Flash Player PocketPC Developer
Release documentation for details.)
Experienced scripters should first read the
article Scripting
with Flash for an overview of JavaScript
methods which can control the Flash Player.
Beginning scripters may benefit more from the
example based Technotes "An example of communication between
JavaScript and Flash" (TechNote 15683) and "An example of communication between
Flash movies" (TechNote 15692).
Note: Most of these methods, properties and
events are not available in the Netscape Navigator
plug-in version of the Macromedia Flash Player,
only the Flash Player ActiveX control for
Windows.
Properties
ReadyState (get only) - 0=Loading,
1=Uninitialized, 2=Loaded, 3=Interactive,
4=Complete.
TotalFrames (get only) - Returns
the total number of frames in the movie. This is
not available until the movie has loaded. Wait for
ReadyState = 4.
FrameNum (get or set) - The
currently displayed frame of the movie. Setting
this will advance or rewind the movie.
Playing (get or set) - True if the
movie is currently playing, false if it is
paused.
Quality (get or set) - The current
rendering quality (0=Low, 1=High, 2=AutoLow,
3=AutoHigh). This is the same as the QUALITY
parameter.
ScaleMode (get or set) - Scale mode
(0=ShowAll, 1= NoBorder, 2 = ExactFit). This is
the same as the SCALE parameter.
AlignMode (get or set) - The align
mode consists of bit flags. (Left=+1, Right=+2,
Top=+4, Bottom=+8). This is the same as the SALIGN
parameter.
BackgroundColor (get or set) -
Override the background color of a movie. An
integer of the form red*65536+green*256+blue use
-1 for the default movie color.
Loop (get or set) - True if the
animation loops, false to play once. Same as the
MOVIE parameter.
Movie (get or set) - The URL source
for the Flash Player movie file. Setting this will
load a new movie into the control. Same as the
MOVIE parameter.
Methods
Play() - Start playing the
animation.
Stop() - Stop playing the
animation.
Back() - Go to the previous
frame.
Forward() - Go to the next
frame.
Rewind() - Go to the first
frame.
SetZoomRect(int left, int top, int
right, int bottom) - Zoom in on a rectangular area
of the movie. Note that the units of the
coordinates are in twips (1440 units per inch). To
calculate a rectangle in Flash, set the ruler
units to Points and multiply the coordinates by 20
to get TWIPS.
Zoom(int percent) - Zoom the view
by a relative scale factor. Zoom(50) will double
the size of the objects in the view. Zoom(200)
will reduce the size of objects in the view by one
half.
Pan(int x, int y, int mode) - Pan a
zoomed in movie. The mode can be: 0 = pixels, 1 =
% of window.
Events
OnProgress(int percent) - Generated
as the Flash Player movie is downloading.
OnReadyStateChange(int state) -
Generated when the ready state of the control
changes. The possible states are 0=Loading,
1=Uninitialized, 2=Loaded, 3=Interactive,
4=Complete.
FSCommand(string command, string
args) - This event is generated when a GetURL
action is performed in the movie with a URL and
the URL starts with "FSCommand:". The portion of
the URL after the : is provided in command and the
target is provided in args. This can be used to
create a response to a frame or button action in
the Shockwave Flash movie.
HTML
The HTML to insert the Flash Player
ActiveX control and a movie in a page is:
<OBJECT ID="map" CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
CODEBASE="http://active.macromedia.com/flash5/cabs/swflash.cab#version=5,0,0,0"
width=300 height=150 align=center>
<param NAME="Movie" VALUE="map.swf">
<param NAME="Play" VALUE="False">
<param NAME="Loop" VALUE="False">
<param NAME="Quality" VALUE="High">
<param NAME="Scale" VALUE="ShowAll">
<param NAME="SAlign" VALUE="TR">
<param NAME="BGColor" VALUE="808080">
</OBJECT>
|